﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Data;
using Volo.Abp.Domain.Entities;
using Volo.Abp.MultiTenancy;

namespace ERP.Workflow.Designer.Domain
{
    public class FlowLinkExtendValue
    {
        public string? Expression { get; set; }
        public string? Content { get; set; }
    }
    public class Link : AggregateRoot<Guid>, IMultiTenant, ISoftDelete
    {
      

        public void SetId(Guid id)
        {
            Id = id;
        }
        public Guid? TenantId { get; set; }
        public string? Content { get; set; }
        public bool Selected { get; set; }
        public string? Color { get; set; }
        public string? SelectedColor { get; set; }
        public double Width { get; set; } = 2.0;

      
        public string? Paths { get; set; }

        public Guid? SourceNodeId { get; set; }
        public Guid? TargetNodeId { get; set; }
        public Guid? SourcePortId { get; set; }
        public Guid? TargetPortId { get; set; }





        public string? SourceLinkMarkerPath { get; set; }
        public double SourceLinkMarkerWidth { get; set; }
        public string? TargetLinkMarkerPath { get; set; }
        public double TargetLinkMarkerWidth { get; set; }



        public List<LinkVertex> Vertices { get;set; }=new List<LinkVertex>();
        public List<LinkLabel> Labels { get; set; }=new List<LinkLabel>();


        public virtual Node? SourceNode { get; set; }
        public Node? TargetNode { get; set; }
        public Port? SourcePort { get; set; }
        public Port? TargetPort { get; set; }


        public Guid DefinitionId { get; set; }
        public Definition Definition { get; set; }
        public bool IsDeleted { get; set; }

        public void SoftDelete()=>IsDeleted=true;
        public void SetTenantId(Guid tenantId) => TenantId = tenantId;
        public void SetSourceNodeId(Guid? sourceNodeId) => SourceNodeId = sourceNodeId;
        public void SetTargetNodeId(Guid? targetNodeId) => TargetNodeId = targetNodeId;
        public void SetTargetPortId(Guid? targetPortId) => TargetPortId = targetPortId;
        public void SetSourcePortId(Guid? sourcePortId) => SourcePortId = sourcePortId;

        public void SetTargetLinkMarker(string? parth,  double width)
        { 
            TargetLinkMarkerPath = parth;
            TargetLinkMarkerWidth = width;
        }
        public void SetSourceLinkMarker(string? parth, double width)
        {
            SourceLinkMarkerPath = parth;
            SourceLinkMarkerWidth = width;
        }
        public void Set(string content, string? path, double width, string? color, string? selectedColor)
        {
            Paths = path;
            Width = width;
            Color = color;
            SelectedColor = selectedColor;
            Content = content;
        }

    }
}
